/**
 * 
 */
package com.greatwideweb.sendtoself.sqlite;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

/**
 * @author dave
 *
 */
public class DBHelper extends SQLiteOpenHelper {

	/**
	 * @param context
	 * @param name
	 * @param factory
	 * @param version
	 */
	
	private static final String DATABASE_NAME = "sendtoself";
  private static final int DATABASE_VERSION = 1;
  private static final String CREATE_EMAIL_TABLE = " create table email ( email text not null); ";
  private static final String DROP_EMAIL_TABLE = " DROP TABLE IF EXISTS email ";
  
  DBHelper(Context context) {
      super(context, DATABASE_NAME, null, DATABASE_VERSION);
  }

	/* (non-Javadoc)
	 * @see android.database.sqlite.SQLiteOpenHelper#onCreate(android.database.sqlite.SQLiteDatabase)
	 */
	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(CREATE_EMAIL_TABLE);
	}

	/* (non-Javadoc)
	 * @see android.database.sqlite.SQLiteOpenHelper#onUpgrade(android.database.sqlite.SQLiteDatabase, int, int)
	 */
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		db.execSQL(DROP_EMAIL_TABLE);
    onCreate(db);

	}

}
